<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateDevelopmentTable extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table = $this->table('development', ['engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '技术部成员表']);
        $table
            ->addColumn(Column::string('name', 50)->setComment('名称'))
            ->addColumn(Column::tinyInteger("sex")->setDefault(0)->setComment("性别：0-未知 1-男 2-女"))
            ->addColumn(Column::string('real_name', 30)->setDefault('')->setComment('真实姓名'))
            ->addColumn(Column::string('position', 30)->setDefault('')->setComment('职位'))
            ->addColumn(Column::string('description', 255)->setComment('描述'))
            ->addColumn(Column::integer('status')->setDefault(1)->setComment('状态'))
            ->addColumn(Column::integer('create_time')->setComment('创建时间'))
            ->addColumn(Column::integer('update_time')->setComment('更新时间'))
            ->addColumn(Column::tinyInteger('is_delete')->setDefault(0)->setComment('是否删除：0-否 1-是'))
            ->addColumn(Column::integer('delete_time')->setComment('删除时间'))
            ->create();
    }
}
